import Vue from "vue";
import VueRouter from "vue-router";


Vue.use(VueRouter);

//https://router.vuejs.org/guide/essentials/passing-props.html
const User = {
  props: ["routerProp", "routerProp2"],
  template: "<div>User {{ id }}</div>",
};

const routes = [
 
  {
    path: "/login",
    name: "CesiumHome",
    component: () =>
      import(/* webpackChunkName: "CesiumHome" */ "../views/CesiumHome.vue"),
  },

  {
    path: "/cesium",
    name: "HelloCesium",
    component: () =>
      import(/* webpackChunkName: "CesiumHome" */ "../components/HelloCesium.vue"),
  },
 
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

router.beforeEach((routeTo, routeFrom, next) => {
  if (routeTo.path == routeFrom.path) {
    console.log("double navigation");
    return;
  }
  console.log(`From ${routeFrom.path} to ${routeTo.path}`);
  next();
});

router.afterEach(() => {
  //console.log("After each route triggered");
});
export default router;
